<script>
import eventBus from "@/utils/eventBus";
export default {
  name: "children",
  data() {
    return {
      childCount: 0
    }
  },
  methods:{
    eventFn(count){
      this.childCount=count
    }
  },
  created() {
    eventBus.on("changeCount",this.eventFn)
  },
  beforeUnmount() {
   eventBus.off("changeCount",this.eventFn)
  }
}
</script>

<template>
  <div class="children">
    <h1> childCount：{{ childCount }}</h1>
  </div>
</template>

<style scoped lang="less">

</style>